<template>
    <div id="oppoPrint">
        <table
                bordercolorlight="#000000"
                bordercolordark="#FFFFFF"
                width="100%"
                cellspacing="0"
                cellpadding="2"
                border="1"
        >
            <tbody>
            <tr>
                <td width="95%">
                    <table
                            bordercolorlight="#000000"
                            bordercolordark="#FFFFFF"
                            width="100%"
                            cellspacing="0"
                            cellpadding="3"
                            border="1"
                    >
                        <tbody>
                        <tr>
                            <td colspan="2" style="font-size: 24pt; font-weight: bold">
                                <p align="center">湖南罗小黑科技有限公司</p>
                            </td>
                        </tr>
                        <tr>
                            <td colspan="2">
                                <p align="center">湖南省株洲市天元区88号</p>
                            </td>
                        </tr>
                        <tr>
                            <td width="65%">电话：0751-888888 传真：0755-83751711转8015</td>
                            <td width="35%">机会名称：{{oppotunity.oppoName}}</td>
                        </tr>
                        <tr>
                            <td width="55%">机会状态：{{oppotunity.state.oppoStateName}}</td>
                            <td width="45%">预计成交日期：{{oppotunity.planIdealTime | format_date}}</td>
                        </tr>
                        <tr>
                            <td>客户名称：{{oppotunity.customer?oppotunity.customer.customerName:"无"}}</td>
                        </tr>
                        <tr>
                            <td width="65%">客户地址：{{oppotunity.customer.workAddress}}</td>
                            <td width="35%">联系邮箱：{{oppotunity.customer.emailAddress}}</td>
                        </tr>
                        <tr>
                            <td colspan="2">
                                <div class="bootstrap-table">
                                    <div class="fixed-table-container">
                                        <table
                                                id="tb_orderDetail"
                                                style="word-wrap: break-word; word-break: break-all;LINE-HEIGHT: 150%; WIDTH: 100%; BORDER-COLLAPSE: collapse; EMPTY-CELLS: show; FONT-SIZE: 14px"
                                                border="1"
                                                cellpadding="3"
                                                class="table-s00"
                                                width="100%"
                                                cellspacing="0"
                                        >
                                            <thead>
                                            <tr>
                                                <th style="text-align: left" class="th-inner">
                                                    <span style="font-family: 楷体">品名</span>
                                                </th>
                                                <th style="text-align: left" class="th-inner">
                                                    <span style="font-family: 楷体">品牌</span>
                                                </th>
                                                <th style="text-align: left" class="th-inner">
                                                    <span style="font-family: 楷体">规格</span>
                                                </th>
                                                <th style="text-align: right" class="th-inner">
                                                    <span style="font-family: 楷体">单位</span>
                                                </th>
                                                <th style="text-align: right" class="th-inner">
                                                    <span style="font-family: 楷体">数量</span>
                                                </th>
                                                <th style="text-align: right" class="th-inner">
                                                    <span style="font-family: 楷体">报价</span>
                                                </th>
                                                <th style="text-align: right" class="th-inner">
                                                    <span style="font-family: 楷体">金额</span>
                                                </th>
                                            </tr>
                                            </thead>
                                            <tr v-for="pro in oppotunity.oppoProList" :key="pro.detailOfferId">
                                                <td class="text-left">{{ pro.productDetail.product.productName }}</td>
                                                <td class="text-left">{{ pro.productDetail.product.productBrand }}</td>
                                                <td class="text-left">
                                <span v-for="ab in pro.productDetail.abilities" :key="ab.abilityId">
                                    {{ab.attribute.attrName}}:{{ab.abilityName}}
                                </span>
                                                </td>
                                                <td class="text-right">只</td>
                                                <td class="text-right">{{ pro.productNum }}</td>
                                                <td style="white-space: nowrap;" class="text-right">
                              <span style="white-space:nowrap">
                                <span style="font-size:9pt;font-weight:normal;">￥</span>{{pro.offer}}
                              </span>
                                                </td>
                                                <td style="white-space: nowrap;" class="text-right">
                              <span style="white-space:nowrap">
                                <span style="font-size:9pt;font-weight:normal;">￥</span>{{ pro.productNum*pro.offer }}
                              </span>
                                                </td>
                                            </tr>
                                            <tr>
                                                <td colspan="4" class="text-left">
                                                    <font face="楷体">
                                                        <b>合计</b>
                                                    </font>
                                                </td>
                                                <td style="white-space: nowrap;" class="text-right">{{totalNum}}</td>
                                                <td class="text-right">&nbsp;</td>
                                                <td style="white-space: nowrap;" class="text-right">
                              <span style="white-space:nowrap">
                                <span style="font-size:9pt;font-weight:normal;">￥</span>{{ totalPrice }}
                              </span>
                                                </td>
                                                <td class="text-left">&nbsp;</td>
                                            </tr>
                                            <tr>
                                                <td align="left" colspan="4">
                                                    <font face="楷体">总计（大写金额）</font>
                                                </td>
                                                <td align="right" colspan="4">
                                                    <font face="楷体">捌仟贰佰玖拾玖元整</font>
                                                </td>
                                            </tr>
                                        </table>
                                    </div>
                                </div>
                            </td>
                        </tr>
                        <tr>
                            <td colspan="2">
                                总金额：
                                <span style="white-space:nowrap">
                      <span style="font-size:9pt;font-weight:normal;">￥</span>{{totalPrice}}
                    </span>
                            </td>
                        </tr>
                        <tr>
                            <td colspan="2">业务员：{{oppotunity.worker.empName}}</td>
                        </tr>
                        </tbody>
                    </table>
                </td>
            </tr>
            </tbody>
        </table>
    </div>
</template>

<script>
    export default {
        name: "oppoPrint",
        props:['oppotunity'],
        data(){
            return{
                hisLinkMan:[] // 联系人
            }
        },
        computed:{
            totalNum(){
                let total = 0
                this.oppotunity.oppoProList.forEach(pl => {
                    total += pl.productNum
                })
                return total
            },
            totalPrice(){
                let t = 0;
                this.oppotunity.oppoProList.forEach(tol=>{
                    t = t + (tol.productNum * tol.offer);
                });
                return t;
            },
        },
        created(){

        }
    }
</script>

<style scoped>

</style>